﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MediaLibraryManagement.UI
{
    public partial class AlbumSearchPane : UserControl
    {
        public string Title
        {
            get
            { 
                if(string.IsNullOrWhiteSpace(txtTitle.Text))
                {
                    txtTitle.Text = txtTitle.Text.Trim();
                }
                return txtTitle.Text;
            }
        }

        public string Genre
        {
            get
            {
                if (string.IsNullOrWhiteSpace(txtGenre.Text))
                {
                    txtGenre.Text = txtGenre.Text.Trim();
                }
                return txtGenre.Text;
            }
        }

        public string ArtistName
        {
            get
            {
                if (string.IsNullOrWhiteSpace(txtArtist.Text))
                {
                    txtArtist.Text = txtArtist.Text.Trim();
                }
                return txtArtist.Text;
            }
        }

        public int ReleaseYear
        {
            get
            {
                return string.IsNullOrWhiteSpace(cboYear.Text) ? 0 : (int)cboYear.SelectedValue;
            }
        }
        public AlbumSearchPane()
        {
            InitializeComponent();
            List<int> years = new List<int>();
            for (int i = DateTime.Today.Year; i >= DateTime.Today.Year - 60; i--)
            {
                years.Add(i);
            }
            cboYear.DataSource = years;
        }
    }
}
